//
//  Ugc_Release_VC_WX_V4.m
//  ZITHER
//
//  Created by weixin on 2018/11/8.
//  Copyright © 2018 weixn. All rights reserved.
//

#import "Ugc_Release_VC_WX_V4.h"
#import "UGC_TopicSubjectslist_model.h"

@interface Ugc_Release_VC_WX_V4 ()

@property (nonatomic,assign)BOOL type;

@property (nonatomic,strong)BaseLab * TopicLab;//发布话题
@property (nonatomic,strong)BaseImageV * TopicIcon;//发布话题icon
@property (nonatomic,strong)BaseImageV * cancelBtn;//取消话题
@property (nonatomic,strong)UGC_TopicSubjectslist_model * model;//取消话题

@property (nonatomic,copy)NSString * TopicID;//话题ID


@end

@implementation Ugc_Release_VC_WX_V4

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setNav];
    [self setUI];
    [self loadTopiclist];
    @weakify(self);
    self.type = YES;
    self.fd_interactivePopDisabled = YES;

    [RACObserve(self.viewImage,arrM)subscribeNext:^(id  _Nullable x) {
        @strongify(self);
//        self.tabBarController.tabBar.hidden=NO;

        if (self.viewImage.arrM.count==0) {
            self.sendBtn.titleLabel.alpha = 0.4;
        }else{
            self.sendBtn.titleLabel.alpha = 1;
        }
    }];
    
    [RACObserve(self.tabBarController.tabBar, hidden)subscribeNext:^(id  _Nullable x) {
        if (!self.tabBarController.tabBar.hidden && self.type) {
            self.tabBarController.tabBar.hidden = YES;
        }
    }];
    
    [RACObserve(self.TopicLab, text)subscribeNext:^(id  _Nullable x) {
        if (self.id.length>0) {
            return ;
        }
        if (![self.TopicLab.text isEqualToString:@"    话题"]) {
            self.cancelBtn.hidden = NO;
        }else{
            self.cancelBtn.hidden = YES;
        }
    }];
    
    
//    [RACObserve(self.viewImage.imageSelect,frame)subscribeNext:^(id  _Nullable x) {
//        @strongify(self);
    
//        CGFloat h = CGRectGetMaxY(self.viewImage.imageSelect.frame)+10;
//        [self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
//            @strongify(self);
//            make.top.equalTo(self.baseNavigationView.mas_bottom).offset(30);
//            make.left.equalTo(self.view).offset(14);
//            make.right.equalTo(self.view).offset(-14);
//            make.height.mas_equalTo(100);
//        }];
//    }];

}
-(void)setTopictitle:(NSString *)Topictitle{
    _Topictitle = Topictitle;
    self.TopicLab.text = [NSString stringWithFormat:@"   %@",Topictitle];
    self.cancelBtn.hidden = YES;
}

-(void)loadTopiclist{
    [[serviceDefualt loadTopicSubjectslistPage:0 reponseObjctClass:[UGC_TopicSubjectslist_model class]]subscribeNext:^(ResponseData* x) {
        if (x.success) {
            self.model = [UGC_TopicSubjectslist_model yy_modelWithDictionary: x.responseRawData];
        }else{
            [Tools showTips:x.errorInfo];
        }
    }];
    
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.tabBarController.tabBar.hidden=YES;
}
-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
//    self.tabBarController.tabBar.hidden=NO;
}
-(void)setNav{

    self.baseNavigationView.titleLabel.text = @"新动态";
    self.baseNavigationView.titleLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:17];
    [self.baseNavigationView addSubview:self.sendBtn];
    [self.baseNavigationView setHiddenNav:NO VC:self];
    if ([Main_Token_Model_MANAGER.isToken isEqualToString:@"1"]){
        self.baseNavigationView.backgroundColor = Main_Token_Model_MANAGER.backgroundColor ;

//        self.backgroundColor = Main_Token_Model_MANAGER.backgroundColor ;
    }else{
        self.baseNavigationView.backgroundColor = [UIColor whiteColor] ;
    }
    
    @weakify(self);
    [[self.baseNavigationView.leftButton1 rac_signalForControlEvents:(UIControlEventTouchUpInside)] subscribeNext:^(__kindof UIControl * _Nullable x) {
        @strongify(self);
        self.type = NO;
        self.tabBarController.tabBar.hidden=NO;
//        [self.navigationController popViewControllerAnimated:YES];
//        [self disappearView];
    }];
    
}

-(void)setUI{
    
    [self.view addSubview:self.progressView];
    [self.view addSubview:self.viewImage];
    [self.view addSubview:self.labProgress];
    [self.view addSubview:self.textView];
    
    [self.view addSubview:self.TopicLab];
    [self.view addSubview:self.TopicIcon];
    [self.view addSubview:self.cancelBtn];

    
    UIView *view = [[UIView alloc]init];
    view.backgroundColor = [UIColor whiteColor];
    view.tag = 999;
    view.hidden = YES;
    [view setShadowRadiusWithColor:[UIColor colorWithHex:@"000000"] offset:CGSizeZero opacity:0.1 radius:4];
    [self.view addSubview:view];
    [self.view addSubview:self.tbv];
    



    @weakify(self);
    
    [self.sendBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.centerY.equalTo(self.baseNavigationView.titleLabel.mas_centerY).offset(0);
        make.right.equalTo(self.baseNavigationView).offset(-15);
        make.height.mas_equalTo(30);
    }];
    [self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.top.equalTo(self.viewImage.imageSelect.mas_bottom).offset(20);
        make.left.equalTo(self.view).offset(14);
        make.right.equalTo(self.view).offset(-14);
        make.height.mas_equalTo(100);
    }];
    
    [self.progressView mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.top.equalTo(self.textView.mas_bottom).offset(12);
        make.right.equalTo(self.view).offset(-14);
        make.height.width.mas_equalTo(25);
    }];
    //    self.viewImage.backgroundColor = [UIColor randomColor];
    [self.viewImage mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.top.equalTo(self.baseNavigationView.mas_bottom).offset(20);
        make.left.equalTo(self.view).offset(14);
        make.right.equalTo(self.view).offset(-14);
        make.height.mas_equalTo(400);
    }];
    
    [self.labProgress mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.center.equalTo(self.progressView).offset(0);
    }];
    
    int maxW = kScreenW - 70-15;
    [self.TopicLab mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.centerY.equalTo(self.progressView.mas_centerY).offset(0);
        make.left.equalTo(self.view).offset(14);
//        make.right.equalTo(self.view).offset(-70);
//        make.width.greaterThanOrEqualTo(@200); make.width.lessThanOrEqualTo(@400)
        make.width.lessThanOrEqualTo(@(kScreenW-90));
        make.height.mas_equalTo(15);
    }];
    
    [self.TopicIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.top.equalTo(self.TopicLab.mas_top).offset(2);
        make.left.equalTo(self.TopicLab.mas_left).offset(0);
        make.size.mas_equalTo(CGSizeMake(10, 13));
    }];
    
    [self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.centerY.equalTo(self.TopicLab.mas_centerY).offset(0);
        make.left.equalTo(self.TopicLab.mas_right).offset(10);
        make.height.width.mas_equalTo(10);
    }];
    
    [self.tbv mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.top.equalTo(self.TopicLab.mas_bottom).offset(10);
        make.left.equalTo(self.view).offset(14);
        make.height.mas_equalTo(170);
        make.width.mas_equalTo(280);
    }];
    
    [view mas_makeConstraints:^(MASConstraintMaker *make) {
        @strongify(self);
        make.top.left.equalTo(self.tbv).offset(-2);
        make.right.bottom.equalTo(self.tbv).offset(2);
    }];
    
    
}


-(QMUILabel *)labProgress{
    if (!_labProgress) {
        _labProgress = [[QMUILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 30)];
        _labProgress.text = @"1";
        _labProgress.font = [UIFont systemFontOfSize:9];
        _labProgress.textColor = [UIColor blackColor];
        _labProgress.textAlignment = NSTextAlignmentCenter;
        _labProgress.hidden = YES;
        self.progressView.centerView = _labProgress;
    }
    return _labProgress;
}

- (JZProgressView *)progressView{
    if (!_progressView) {
        _progressView = [[JZProgressView alloc]initWithFrame:CGRectMake(100,100, 25, 25)];
        _progressView.layer.backgroundColor = [UIColor whiteColor].CGColor;
        _progressView.progressStrokeWidth = 3.f;
        _progressView.progressValue = 0.01;
        _progressView.progressTrackColor = baseColorLight;
        _progressView.progressColor = baseColorRepainting;
        
    }
    return _progressView;
}

-(QMUITextView *)textView{
    if (!_textView) {
        _textView = [[QMUITextView alloc]initWithFrame:CGRectMake(15, 100, kScreenW-30,300)];
        _textView.backgroundColor = [UIColor whiteColor];
        _textView.placeholder = @"关于手表的一切";
        _textView.placeholderColor = baseColorLight; // 自定义 placeholder 的颜色
        _textView.textContainerInset = UIEdgeInsetsMake(10, 7, 10, 7);
        _textView.returnKeyType = UIReturnKeyDone;
        _textView.delegate = self;
        _textView.enablesReturnKeyAutomatically = YES;
        _textView.tintColor = [UIColor blackColor];
        _textView.typingAttributes = @{NSFontAttributeName: UIFontMake(18),
                                       NSForegroundColorAttributeName: [UIColor blackColor],
                                       NSParagraphStyleAttributeName: [NSMutableParagraphStyle qmui_paragraphStyleWithLineHeight:18]};
        // 限制可输入的字符长度
        _textView.maximumTextLength = 400;
        
        
    }
    return _textView;
}

- (UGCReleaseAddImage *)viewImage{
    if (!_viewImage) {
        _viewImage = [[UGCReleaseAddImage alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 300)];
    }
    return _viewImage;
}




#pragma mark - 上传图片
- (void)uploadImageWithPhotos:(NSArray<UIImage *> *)photos completion:(AskImageUploadBlock)completion {
    //  开启菊花
    //    [QMUITips showLoadingInView:self.view];
    // 调度组
    dispatch_group_t group = dispatch_group_create();
    // 队列
    dispatch_queue_t queue = dispatch_get_global_queue(0, 0);
    __block NSMutableArray<NSString *> *uploadURLs = @[].mutableCopy;
    
    
    
    
    self.arrMName = [[NSMutableArray alloc]init];
    NSString *date = [NSString currentDateDateFormatter:@"yyyyMM"];
    NSString *path =[NSString stringWithFormat:@"/ugc/%@",date];
    NSString *Timestamp = [Tools getCurrentTimestamp];
    
    for (int i = 0; i<photos.count; i++) {
        
        /** 设置名称 */
        
        NSString *imageType = [Tools contentTypeWithImage:photos[i]];
        
        NSString * fileName1 = [NSString stringWithFormat:@"%@_%@_%d.%@",kUSER_INFO_MANAGER.userId,Timestamp,i,imageType];
        [self.arrMName addObject:fileName1];
        
    }
    
    
    
    for (NSUInteger i = 0; i< photos.count; i++) {
        
        UIImage *image = [photos objectAtIndex:i];
        
        //分别开组
        dispatch_group_enter(group);
        dispatch_group_async(group, queue, ^{
            
            @weakify(uploadURLs);
            ///ugc/201810/0B374CCAD80711E89B155254005876C0_1540446908_0.png
            ///ugc/201810/0B374CCAD80711E89B155254005876C0_1540446945_2.png
            ///ugc/201810/0B374CCAD80711E89B155254005876C0_1540446957_1.png
            ///ugc/201810/0B374CCAD80711E89B155254005876C0_1540447001_3.png
            ///ugc/201810/0B374CCAD80711E89B155254005876C0_1540447929_0.png,
            ///ugc/201810/0B374CCAD80711E89B155254005876C0_1540447929_3.png,
            ///ugc/201810/0B374CCAD80711E89B155254005876C0_1540447929_1.png,
            ///ugc/201810/0B374CCAD80711E89B155254005876C0_1540447929_2.png
            //            [kNetworkShared getImageURLWithImageOld:image Path:path batchIndex:i completion:^(COSObjectUploadTaskRsp *uploadTaskRsp, NSString *filePath, NSString *fileName, BOOL isSuccess, NSError *error) {
            //                @strongify(uploadURLs);
            //                if (isSuccess) {
            //                    [uploadURLs addObject:kSTRING_FORMAT(@"%@/%@",filePath, fileName)];
            //                }
            //                dispatch_group_leave(group);
            //            }];
            [kNetworkShared getImageURLWithImage:image Path:path fileName:self.arrMName[i] batchIndex:i Timestamp:Timestamp completion:^(COSObjectUploadTaskRsp *uploadTaskRsp, NSString *filePath, NSString *fileName, BOOL isSuccess, NSError *error) {
                @strongify(uploadURLs);
                if (isSuccess) {
                    [uploadURLs addObject:kSTRING_FORMAT(@"%@/%@",filePath, fileName)];
                }else{
                    [Tools showTips:error];
                }
                dispatch_group_leave(group);
            }];
            
            
            
            
            
        });
    }
    //完成通知
    dispatch_group_notify(group, dispatch_get_main_queue(), ^{
        //        [QMUITips hideAllTipsInView:self.view];
        if (uploadURLs.count == photos.count) {
            //            NSString *imgURLs = [uploadURLs componentsJoinedByString:@","];
            // 全部上传成功
            
            for (int i = 0; i<self.arrMName.count; i++) {
                self.arrMName[i] = kSTRING_FORMAT(@"%@/%@",path, self.arrMName[i]);
            }
            NSString *strid = @"";
            if (self.id.length>0) {
                strid = self.id;
            }else{
                strid = self.TopicID;
            }
            
            [[serviceDefualt loadGetAddUserUgc:self.textView.text fileList:self.arrMName userSubjectId:strid reponseObjctClass:nil]subscribeNext:^(ResponseData * x) {
                if (x.success) {
                    if (completion) {
                        completion(YES, nil);
                    }
                }else{
                    if (completion) {
                        completion(NO, nil);
                    }
                }
            }];
            /** 旧的写法 */
            //            [[ serviceDefualt loadGetAddUserUgc:self.textView.text fileList:uploadURLs userSubjectId:self.TopicID reponseObjctClass:nil]subscribeNext:^(ResponseData * x) {
            //                if (x.success) {
            //                    if (completion) {
            //                        completion(YES, nil);
            //                    }
            //                }else{
            //                    if (completion) {
            //                        completion(NO, nil);
            //                    }
            //                }
            //            }];
            
        } else {
            if (completion) {
                completion(NO, nil);
            }
        }
    });
}


-(void)send{
    
    UgcReleaseFailureModel *modelson = [[UgcReleaseFailureModel alloc]init];
    modelson.content = self.textView.text;
    modelson.arrMPic = [[NSMutableArray alloc]init];
    [self.view endEditing:YES];
    [self disappearView];
    
    //是否有图片
    if (self.viewImage.arrM.count > 0) {
        //有图片  先上传图片
        for (int i =0; i<self.viewImage.arrM.count; i++) {
            [modelson.arrMPic addObject:self.viewImage.arrM[i]];
        }
        @weakify(self);
     
        
        [self uploadImageWithPhotos:self.viewImage.arrM.copy completion:^(BOOL isSuccess, NSString *imageURLs) {
            @strongify(self);
            if (isSuccess) {
                [Tools showTips:@"发送成功"];
                //                [self endEditing:YES];
                //                [self disappearView];
            } else {
                [kUSER_INFO_MANAGER addFailureModel:modelson];
                [Tools showTips:@"发送失败"];
                //                [self disappearView];
            }
        }];
    }else{
        //没图片
        @weakify(self);
       
        NSString *strid = @"";
        if (self.id.length>0) {
            strid = self.id;
        }else{
            strid = self.TopicID;
        }
        [[ serviceDefualt loadGetAddUserUgc:self.textView.text fileList:nil userSubjectId:strid reponseObjctClass:nil]subscribeNext:^(ResponseData * x) {
            @strongify(self);
            if (x.success) {
                [Tools showTips:@"发送成功"];
                //                [self endEditing:YES];
                //                [self disappearView];
            }else{
                
                [kUSER_INFO_MANAGER addFailureModel:modelson];
                [Tools showTips:@"发送失败"];
                //                [self disappearView];
            }
            
        }];
    }
}

-(void)disappearView{
    self.type = NO;
    self.tabBarController.tabBar.hidden=NO;
    [self.navigationController popViewControllerAnimated:YES];
    
//    UIViewController *rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
//    UIViewController *currentVC = [self getCurrentVCFrom:rootViewController];
//
//    [UIView animateWithDuration:0.1 animations:^{
//        self.view .frame = CGRectMake(0, -20, kScreenW, kScreenH);
//    } completion:^(BOOL finished) {
//        [UIView animateWithDuration:0.2 animations:^{
//            self.view .frame = CGRectMake(0, kScreenH, kScreenW, kScreenH);
//        } completion:^(BOOL finished) {
//            [UIView animateWithDuration:0.1 animations:^{
//                [currentVC.tabBarController.tabBar setHidden:NO];
//            }];
//        }];
//    }];
}

- (UIViewController *)getCurrentVCFrom:(UIViewController *)rootVC
{
    UIViewController *currentVC;
    
    if ([rootVC presentedViewController]) {
        // 视图是被presented出来的
        
        rootVC = [rootVC presentedViewController];
    }
    
    if ([rootVC isKindOfClass:[UITabBarController class]]) {
        // 根视图为UITabBarController
        
        currentVC = [self getCurrentVCFrom:[(UITabBarController *)rootVC selectedViewController]];
        
    } else if ([rootVC isKindOfClass:[UINavigationController class]]){
        // 根视图为UINavigationController
        
        currentVC = [self getCurrentVCFrom:[(UINavigationController *)rootVC visibleViewController]];
        
    } else {
        // 根视图为非导航类
        
        currentVC = rootVC;
    }
    
    return currentVC;
}

- (void)textViewDidChangeSelection:(UITextView *)textView{
    NSLog(@"字数 : %ld",textView.text.length);
    
    NSInteger textLength = textView.text.length;
    
    if (textLength == 0) {
        if (self.viewImage.arrM.count==0) {
            self.sendBtn.titleLabel.alpha = 0.4;
        }else{
            self.sendBtn.titleLabel.alpha = 1;
        }
    }else{
        _sendBtn.titleLabel.alpha = 1;
    }
    
    if (textLength<120) {
        self.labProgress.hidden = YES;
        self.progressView.hidden = NO;
        self.progressView.progressColor = baseColorRepainting;
        
    }else if (textLength<=140){
        self.labProgress.text = [NSString stringWithFormat:@"%ld",140-textLength];
        self.labProgress.textColor = baseColorRepainting;
        self.labProgress.hidden = NO;
        self.progressView.hidden = NO;
        self.progressView.progressColor = baseColorRepainting;
        
    }else if (textLength<150){
        self.labProgress.text = [NSString stringWithFormat:@"%ld",140-textLength];
        self.labProgress.textColor = baseColorForegroundError;
        self.labProgress.hidden = NO;
        self.progressView.hidden = NO;
        self.progressView.progressColor = baseColorForegroundError;
        
    }else{
        self.labProgress.text = [NSString stringWithFormat:@"%ld",140-textLength];
        self.labProgress.textColor = baseColorForegroundError;
        self.labProgress.hidden = NO;
        self.progressView.hidden = YES;
        self.progressView.progressColor = baseColorForegroundError;
    }
    self.progressView.progressValue = (textLength)/140.0;
    
}

-(BaseBtn *)sendBtn{
    if (!_sendBtn) {
//        _sendBtn = [[BaseBtn alloc]initializeFrame:CGRectMake(14,kStatusBarHeight+5,40,20) NormalText:@"发布" NormalTextColor:baseColorTheme SeleText:@"发布" SeleTextColor:baseColorTheme font:15 isBold:NO];
        
//        if ([Main_Token_Model_MANAGER.isToken isEqualToString:@"1"]){
//            _sendBtn = [BaseBtn initCustomBtn:@[@"评论"]];
//            _sendBtn.frame = CGRectMake(14,kStatusBarHeight+5,40,40);
//        }else{
        if ([Main_Token_Model_MANAGER.isToken isEqualToString:@"1"]){
//            self.backgroundColor = Main_Token_Model_MANAGER.backgroundColor ;
            _sendBtn = [BaseBtn initCustomBtnTitlestype:@[@"发布"] color:@[[UIColor whiteColor]]];

        }else{
            _sendBtn = [BaseBtn initCustomBtnTitlestype:@[@"发布"] color:@[baseColorTheme]];

        }
            _sendBtn.frame = CGRectMake(14,kStatusBarHeight+5,40,20);
            _sendBtn.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:15];
//        }
        _sendBtn.backgroundColor = [UIColor clearColor];
        
        
        
        
        _sendBtn.titleLabel.font = [UIFont fontWithName:@"PingFangSC-Semibold" size:15];
        _sendBtn.titleLabel.alpha = 0.4;
        @weakify(self);
        [[_sendBtn rac_signalForControlEvents:(UIControlEventTouchUpInside)] subscribeNext:^(__kindof UIControl * _Nullable x) {
            @strongify(self);
            
            if (self.textView.text.length<=140) {
                if (self.viewImage.arrM.count != 0 || self.textView.text.length != 0) {
                    [self send];
                } else {
                    [self.view endEditing:YES];
                    [Tools showTips:@"内容不许为空"];
                }
            }else {
                [self.view endEditing:YES];
                [Tools showTips:@"字数超过限制"];
            }
            //        [self.navigationController popViewControllerAnimated:YES];
        }];
     
    }
    return _sendBtn;
}





-(BaseImageV *)cancelBtn{
    if (!_cancelBtn) {
        _cancelBtn = [[BaseImageV alloc]initializeFrame:CGRectMake(0, 0, 0, 0) contentMode:2];
        _cancelBtn.image = [UIImage imageNamed:@"发布_删除话题"];
        self.cancelBtn.hidden = YES;
        @weakify(self);
        [[_cancelBtn addTag]subscribeNext:^(id  _Nullable x) {
            @strongify(self);
            self.cancelBtn.hidden = YES;
            self.TopicID = @"";
            self.TopicLab.text = @"    话题";
            self.tbv.indexSelect = 999;
        }];
    }
    return _cancelBtn;
}

-(BaseLab *)TopicLab{
    if (!_TopicLab) {
        _TopicLab = [BaseLab initCustomLab:@"    话题" color:HexColor(0x333333) font: [UIFont fontWithName:@"PingFang-SC-Regular" size:14]];
        _TopicLab.numberOfLines = 1;
        _TopicLab.textColor = baseColorTheme;
        _TopicLab.lineBreakMode = NSLineBreakByCharWrapping;

        [[_TopicLab addTag ]subscribeNext:^(id  _Nullable x) {
            if (self.id.length>0) {
                return ;
            }
            self.tbv.hidden = !self.tbv.hidden;
            [self.view viewWithTag:999].hidden = ![self.view viewWithTag:999].hidden ;
            [self.tbv reloadData];
        }];
    }
    return _TopicLab;
}

-(BaseImageV *)TopicIcon{
    if (!_TopicIcon) {
        _TopicIcon = [[BaseImageV alloc]init];
        _TopicIcon.image = [UIImage imageNamed:@"发布_#话题"];
        _TopicIcon.backgroundColor = [UIColor clearColor];
    }
    return _TopicIcon;
}

-(Ugc_releaseTopic_Tbv_WX *)tbv{
    if (!_tbv) {
        _tbv = [[Ugc_releaseTopic_Tbv_WX alloc]initializeFrame:CGRectMake(0, 0, 0, 0) isMj:3 isEstimatedRowHeight:YES addRegisterNib:@[@"Ugc_releasTopic_Cell_WX"]];
        _tbv.hidden = YES;
        @weakify(self);
        [_tbv setBlock:^(UGC_TopicSubjectslist_modelList * model) {
            @strongify(self);
            self.TopicID = model.id;
            self.TopicLab.text = [NSString stringWithFormat:@"    %@",model.title];
            [self.view viewWithTag:999].hidden = YES;
        }];
        
  
    }
    return _tbv;
}

@end
